﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

using Axe.Extensions;
using System.ComponentModel;
using System.Web;
using System.Drawing.Design;
using System.Web.UI.Design;

namespace Axe.Web.Controls
{
    public class DownloadButton : Button
    {

        [Category("Behavior")]
        [Editor(typeof(UrlEditor), typeof(UITypeEditor))]
        public string DownloadUrl
        {
            get { return ViewState.Get<string>("DownloadUrl"); }
            set { ViewState["DownloadUrl"] = value; }
        }

        [Category("Behavior")]
        public string EulaTextUrl
        {
            get { return ViewState.Get<string>("EulaTextUrl"); }
            set { ViewState["EulaTextUrl"] = value; }
        }

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (!String.IsNullOrEmpty(DownloadUrl))
            {
                HttpContext.Current.Response.Redirect(DownloadUrl,true);
            }
        }
    }
}
